export function getInfo(iden) {
    let val = iden.length;
    let myDate = new Date();
    let month = myDate.getMonth() + 1;
    let day = myDate.getDate();
    let age = null;
    let sex = null;
    let birth = null;

    if (val === 18) {
        age = myDate.getFullYear() - iden.substring(6, 10) - 1;
        sex = iden.substring(16,17);
        birth = iden.substring(6,10)+"-"+iden.substring(10,12)+"-"+iden.substring(12,14);
        if (iden.substring(10, 12) < month || iden.substring(10, 12) == month && iden.substring(12, 14) <= day) age++;
    }
    if(val===15){
        age = myDate.getFullYear() - iden.substring(6, 8) - 1901;
        sex = iden.substring(13,14);
        birth = "19"+iden.substring(6,8)+"-"+iden.substring(8,10)+"-"+iden.substring(10,12);
        if (iden.substring(8, 10) < month || iden.substring(8, 10) == month && iden.substring(10, 12) <= day) age++;
    }
    if(sex!=null){
        if(sex%2 === 0)
            sex = '女';
        else
            sex = '男';
    }
    return {age:age,sex:sex,birth:birth}
}
